import request from '@/utils/request'

// 获取员工简答列表
export const getEmployeesList = () => request.get('/sys/user/simple')

// 获取员工列表
export const getAllEmployeesList = (params) => request.get('/sys/user', { params })

// 新增员工
export const addEmployees = (data) => request.post('/sys/user/batch', data)

// 删除员工
export const delEmployees = (id) => request.delete(`/sys/user/${id}`)

/**
 * @description: 获取用某个用户的信息
 * @param {*} id
 * @return {*}
 */
export function getUserDetailById(id) {
  return request({
    url: `/sys/user/${id}`
  })
}

// 保存员工信息
export const onSaveUser = (data) => request.put(`/sys/user/${data.id}`, data)

export function getJobDetail(id) {
  return request({
    url: `/employees/${id}/jobs`,
    method: 'get'
  })
}
/**
 * @description: 为用户分配角色
 * @param {*} data { id:当前用户id, roleIds:选中的角色id组成的数组 }
 * @return {*}
 */
export function assignRoles(data) {
  return request({
    url: '/sys/user/assignRoles',
    data,
    method: 'put'
  })
}
